﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace Admin.Migrations
{
    public partial class initial16 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "NegativeMenus");

            migrationBuilder.AddColumn<int>(
                name: "MId",
                table: "Menus",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "Path",
                table: "Menus",
                type: "nvarchar(max)",
                nullable: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "MId",
                table: "Menus");

            migrationBuilder.DropColumn(
                name: "Path",
                table: "Menus");

            migrationBuilder.CreateTable(
                name: "NegativeMenus",
                columns: table => new
                {
                    NegativeMenuId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MenuId = table.Column<int>(type: "int", nullable: false),
                    NegativeMenuName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Path = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NegativeMenus", x => x.NegativeMenuId);
                    table.ForeignKey(
                        name: "FK_NegativeMenus_Menus_MenuId",
                        column: x => x.MenuId,
                        principalTable: "Menus",
                        principalColumn: "MenuId",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_NegativeMenus_MenuId",
                table: "NegativeMenus",
                column: "MenuId");
        }
    }
}
